<% if !JobQueue.enabled && JobQueue.executing.empty? %>
  <h2>Failed restart detected (Job-queue is disabled and there are no jobs running). Might need a hard restart.</h2>
<% end %>

<div class="timeline">
  <table class="timeline-content table">
    <thead>
    <tr>
      <% unless @project %>
        <th>Project</th>
      <% end %>
      <th>Started</th>
      <th>
        <% if @project || @stage %>
          <%= link_to_chart "Duration", @deploys.map(&:duration), title: "#{@project&.name || @stage&.name} Deploy duration" %>
        <% else %>
          Duration
        <% end %>
      </th>
      <th>Deploy</th>
      <% unless @stage %>
        <th>Stage</th>
      <% end %>
      <th>Status</th>
    </tr>
    </thead>
    <tbody>
    <%= render partial: "deploys/deploy", collection: @deploys, cached: ->(deploy) { [@project, !!@stage, deploy, params[:time_format].presence || current_user.time_format  ] } %>
    </tbody>
  </table>
  <%= paginate @pagy if @pagy %>
</div>
